import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/net/HttpUtil.dart';
import 'package:ls_work/net/response/food/food_menu_list.dart';
import 'package:ls_work/viewmodel/food/apply_select_food_view_model.dart';

import '../../net/response/food/site_list_data.dart';

class ApplySelectFoodPage extends BaseStatefulMvvmWidget {
  final String date;
  final SiteListData site;
  final String orderType;
  final PickerDataWithIdModel foodTime;
  final int useNumber;
  final List<FoodMenuList> selectFood;
  final num totalPrice;
  final PickerDataWithIdModel userWay;

  ApplySelectFoodPage(
      {required this.date,
      required this.site,
      required this.orderType,
      required this.foodTime,
      required this.useNumber,
      required this.selectFood,
      required this.totalPrice,
      required this.userWay});

  @override
  State<StatefulWidget> createState() => _ApplySelectFoodState();
}

class _ApplySelectFoodState
    extends BaseMvvmState<ApplySelectFoodViewModel, ApplySelectFoodPage> {
  @override
  Widget buildLoadingContentView() {
    return Column(
      children: [
        viewModel.contentWidget().setWeight(1),
        viewModel.bottomWidget()
      ],
    );
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      backgroundColor: Color(0xfff1f1f1),
      appBar: AppBar(
        title: Text('确认订单'),
      ),
      body: loadingContentWidget,
    );
  }

  @override
  ApplySelectFoodViewModel createViewModel() {
    return ApplySelectFoodViewModel(context,
        date: widget.date,
        site: widget.site,
        orderType: widget.orderType,
        foodTime: widget.foodTime,
        useNumber: widget.useNumber,
        selectFood: widget.selectFood,
        totalPrice: widget.totalPrice,userWay: widget.userWay);
  }

  @override
  void onRetryClick() {
    // TODO: implement onRetryClick
  }
}
